<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css?v=4.1.0" rel="stylesheet">

    <link href="/bootstraptable/bootstrap-table.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
    <!--查询条件面板-->
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3>查询条件</h3>
        </div>
        <div class="panel-body">
            <form class="form-horizontal" action="" id="design_module_form">
                <div class="form-group col-md-6">
                    <label class="col-md-4">
                        <div>请输入派工单编号</div>
                    </label>
                    <div class="col-md-8">
                        <input type="text"   class="form-control" id="manufactureId" name="manufactureId">
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <label class="col-md-4">
                        <div>请输入派工单状态</div>
                    </label>
                    <div class="col-md-8">
                        <select id="checkTag" name="checkTag"  class="form-control">
                            <option value="">--请选择--</option>
                            <option value="S001-0">等待审核</option>
                            <option value="S001-1">审核通过</option>
                            <option value="S001-2">审核不通过</option>
                        </select>
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <label class="col-md-4">
                        <div>请输入登记时间：</div>
                    </label>
                    <div class="col-md-4">
                        <input type="date" class="form-control" name="search_registerTime1" id="search_registerTime1">
                    </div>
                    <div class="col-md-4">
                        <input type="date" class="form-control" name="search_registerTime2" id="search_registerTime2">
                    </div>
                </div>
                <div class="form-group col-md-12">
                    <input type="button" id="search_btn" value="查询" class="btn btn-primary btn-sm"/>
                </div>
            </form>
        </div>
    </div>
    <table id="ManufactureManufacture"></table>
</div>
<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/js/plugins/layer/layer.min.js"></script>

<!-- 自定义js -->
<script src="/js/hAdmin.js?v=4.1.0"></script>
<!--<script type="text/javascript" src="/js/index.js"></script>-->

<!-- 第三方插件 -->
<script src="/js/plugins/pace/pace.min.js"></script>

<!--BootstrapTable-->
<script src="/bootstraptable/bootstrap-table.min.js"></script>
<script src="/bootstraptable/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
    $(function(){
        $("#ManufactureManufacture").bootstrapTable({
            // 请求方式
            method: "post",
            // 内容类型：如果请求方式是post，内容类型必须是application/x-www-form-urlencoded
            contentType: "application/x-www-form-urlencoded",
            // 请求路径
            url: '/ManufactureManufacture/show',
            // 数据行交替样式
            striped: true,
             // 是否是服务器端分页：server表示服务器端，client表示前端分页
             sidePagination: 'server',
            //初始化加载第一页
            pageNumber: 1,
            //是否分页
            pagination: true,
            // 单页记录数，页大小
            pageSize: 2,
            // 分页列表
            pageList: [2, 5, 10, 20],
            //刷新按钮
            // showRefresh:true,
            // 请求参数
            queryParams: function (params) {
                let obj = {
                    // params.limit获取组件中的页大小
                    // params.offset获取请求数据的起始索引
                    pageSize: params.limit,
                    pageNo: (params.offset / params.limit) + 1,
                    manufactureId: $("#manufactureId").val(),
                    checkTag: $("#checkTag").val(),
                    search_registerTime1: $("#search_registerTime1").val(),
                    search_registerTime2: $("#search_registerTime2").val(),
                }
                return obj;
            },

            // 表格列标题
            columns: [{
                title: "生产派工单编号",
                field: "manufactureId",
                formatter: function (value, row, index) {
                    return  `<a href="javascript:showById('${row.id}')">${value}</a>`
                }
            }, {
                title: "产品编号",
                field: "productId"
            }, {
                title: "产品名称",
                field: "productName"
            }, {
                title: "投产数量",
                field: "amount",
            }, {
                title: "合格数量",
                field: "testedAmount",
            }, {
                title: "审核状态",
                field: "checkTag",
                formatter: function (value, row, index) {
                    if (row.checkTag == "S001-0")
                        return "等待审核"
                    else if (row.checkTag == "S001-1")
                        return "审核通过"
                    else
                        return "审核不通过"
                }
            }, {
                title: "生产状态",
                field: "manufactureProcedureTag",
                formatter: function (value, row, index) {
                    if (row.manufactureProcedureTag == "S002-0")
                        return " 待登记"
                    else if (row.manufactureProcedureTag == "S002-1")
                        return "未审核"
                    else
                        return "已完工"
                }
            }]
        })
    })
    function showById(id){
        localStorage.setItem("id51",id)
        window.location="/produce/dispatch_work_order_inquiry1UI"
    }
    $("#search_btn").click(function () {
        $("#ManufactureManufacture").bootstrapTable("refresh")
    })
</script>
</body>
</html>